package com.sitech.timing;


import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import com.sitech.context.SpringContext;
import com.sitech.timing.TimingConst;
import com.sitech.timing.domain.GroupTaskInfo;

public class TaskGroupJob implements Job
{

	public void execute(JobExecutionContext context) throws JobExecutionException
	{
		try
		{
			String groupTaskId = (String) context.getJobDetail().getJobDataMap().get(TimingConst.QUARTZ_DATA_MAP_NAME);
			GroupTaskManager groupTaskManager = (GroupTaskManager) SpringContext.getBean("groupTaskManager");

			if (groupTaskId != null && !groupTaskId.equals(""))
			{
				GroupTaskInfo groupTaskInfo = GroupTaskContext.getGroupTaskInfo(groupTaskId);
				groupTaskManager.init(groupTaskInfo);
			}
		}
		catch (Throwable throwable)
		{
			// TODO: handle exception
			throwable.printStackTrace();
		}
	}

}
